package com.one.common.view.dialog;


import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.one.common.R;

/**
 * Author: zhulunjun
 * Email: zhulunjun@qq.com
 * CreateDate: 2020/1/7 14:54
 * Description：头部图片中间文本，下面按钮，认证提示，合同签署提示
 **/
public class ShowTextDialog extends BaseDialog implements View.OnClickListener {
    private TextView tvTitle, tvContent, tvBtnCancel, tvBtnConfirm;
    private ImageView ivTop;
    private View.OnClickListener cancelListener, confirmListener;

    public ShowTextDialog(Context context) {
        super(context, R.layout.dialog_show_text);

        tvTitle = view.findViewById(R.id.tv_title);
        tvContent = view.findViewById(R.id.tv_content);
        tvBtnCancel = view.findViewById(R.id.tv_btn_cancel);
        tvBtnConfirm = view.findViewById(R.id.tv_btn_confirm);
        ivTop = view.findViewById(R.id.iv_top);

        tvBtnCancel.setOnClickListener(this);
        tvBtnConfirm.setOnClickListener(this);
    }

    @Override
    public void initView() {
        super.initView();


    }


    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.tv_btn_cancel) {
            if (cancelListener != null) {
                cancelListener.onClick(v);

            }
        } else if (v.getId() == R.id.tv_btn_confirm) {
            if (confirmListener != null) {
                confirmListener.onClick(v);
            }

        }
        dismiss();
    }

    public void setTvTitle(String title) {
        tvTitle.setText(title);
    }

    public void setTvContent(String content) {
        this.tvContent.setText(content);
    }

    public void setTvBtnCancel(String tvBtnCancel) {
        this.tvBtnCancel.setText(tvBtnCancel);
    }

    public void setTvBtnConfirm(String tvBtnConfirm) {
        this.tvBtnConfirm.setText(tvBtnConfirm);
    }

    public void setIvTop(int res) {
        this.ivTop.setImageResource(res);
    }

    public void setCancelListener(View.OnClickListener cancelListener) {
        this.cancelListener = cancelListener;
    }

    public void setConfirmListener(View.OnClickListener confirmListener) {
        this.confirmListener = confirmListener;
    }
}
